<#macro editBtnView>
<div class="edit-bar">
    <#nested >
</div>
</#macro>
<#macro editView>
<div class="layui-row edit-form">
    <#nested >
</div>
</#macro>
    <#macro editJs saveUrl>
<script type="application/javascript">
    //UI初始化
    layui.use(['element','layer', 'form','table'], function () {
        var form = layui.form;
        var layer = layui.layer;
        //自定义验证规则
        form.verify(verify_rule);
        //监听提交
        form.on('submit', function(data){
            var func = $(this).attr("lay-filter");
            if (typeof window[func] === "function") {
                window[func].call(this,data);
            }
            return false;
        });
    });
    var save = function(data){
        $.ajax({
            url: "${saveUrl!}",
            dataType: "json",
            method: "POST",
            data: data.field,
            success: function (result) {
                if(result.code>0){
                    layer.msg(result.msg,{
                        time: 1000
                    },function(){
                        parent.closeLayer();
                    });
                    $("input[name='id']").val(result.data);
                }else{
                    layer.alert(result.msg,function(){
                        parent.closeLayer();
                    });
                }

            }
        });
    }
</script>
</#macro>